find the period of a function